package com.woniuxy.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

import java.util.Date;
import java.util.List;

/**
 * @author: 杜昊男  <br/>
 * Date: 2022/3/12:10:05  <br/>
 * Description:
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class Comment implements Comparable {
    private int commentid;
    private Integer courseid;
    private int parentid;
    private int userid;
    private String account;
    private String avatar;
    private String content;
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date date;
    private String status;
    private String parentaccount;
    private Integer commentnum;
    private Integer liked;
    private List<Comment> reply;

    @Override
    public int compareTo(Object o) {
        if (o instanceof Comment){
            Comment c = (Comment)o;
            return getDate().compareTo(c.getDate());
        }
      return 0;
    }
}
